<?php
$order_no = $_REQUEST["billNo"]; //商户订单号
$tradeStatus = $_REQUEST["tradeStatus"]; //支付成功状态
$sign = $_REQUEST["sign"]; //验证签名 
$Md5key = "585568557694abf40e541dce26642ea78e3fe999df7aed3496f56203f5b31edd"; //签名密钥，后台提取

if ($tradeStatus==1){
	$resSign = markSign($_REQUEST,$Md5key);
	if ($sign == $resSign){
		//商户处理订单逻辑
		echo "SUCCESS";
	} else {
		exit("签名失败");
	}
}

function markSign($paydata,$signkey){
	ksort($paydata);
	$str='';
	foreach($paydata as $k=>$v){
		if($k != "sign" && $v!= ""){
			$str.=$k."=".$v."&";
		}
	}
	return strtoupper(md5($str."key=".$signkey));
}
?>